
import excel "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Time Spent in Hitler Youth.xlsx", sheet("Sheet1") firstrow

rename NSOrganisation nsorganisation
							
gen	hj	=	1	if	nsorganisation	==	"HJ"
replace	hj	=	1	if	nsorganisation	==	"Flieger-HJ"
replace	hj	=	1	if	nsorganisation	==	"Motor-HJ"
replace	hj	=	1	if	nsorganisation	==	"Marine-HJ"
replace	hj	=	1	if	nsorganisation	==	"Feuerwehr-HJ"
replace	hj	=	1	if	nsorganisation	==	"M.-HJ"
replace	hj	=	1	if	nsorganisation	==	"Nachrichten-HJ"
replace	hj	=	1	if	nsorganisation	==	"Musik-HJ"
replace	hj	=	1	if	nsorganisation	==	"Feldscher-HJ"
replace	hj	=	1	if	nsorganisation	==	"F.-HJ"
replace	hj	=	0	if	hj	!=	1


drop if hj!=1



destring entry_year, replace ignore ("Anfag")

gen m1=int(entry_year)
gen marker=1 if m1==entry_year
replace marker=0 if marker!=1
replace entrymonth=m1 if marker==0
replace entry_year=round((entry_year-m1)*10^4,1) if marker==0
drop marker hj m1



***HY swearing in was on Hitler's birthday every year, so April assumed to be month of joining for all those who are missing a month***

replace entrymonth=4 if entrymonth==.

destring exitmonth exityear, replace

drop marker hj m1


***Now adding in the exit year and month****

rename Austritt_Datum ex_year

destring ex_year, replace 

destring Austritt_Datum_ungenau, generate (year_left) ignore ("Ende")


gen m2=int(year_left)
gen marker=1 if m2==year_left
replace marker=0 if marker!=1
replace exitmonth=m2 if marker==0
replace year_left=round((year_left-m2)*10^4,1) if marker==0

replace exityear=year_left if exityear==.


drop m2 marker year_left ex_year

****Examining Duplicates***

sort PersID
by PersID: gen dup=cond(_N>1,_n,0)

by PersID: egen duplicates=max(dup)

list if duplicates>0

***Some individuals joined different sub-groups of the HJ, for instance fire fighters***

drop if entry_year==. & dup>0

drop if dup>0 &	nsorganisation	==	"Flieger-HJ"
drop if dup>0 &		nsorganisation	==	"Motor-HJ"
drop if dup>0 &		nsorganisation	==	"Marine-HJ"
drop if dup>0 &		nsorganisation	==	"Feuerwehr-HJ"
drop if dup>0 &		nsorganisation	==	"M.-HJ"
drop if dup>0 &		nsorganisation	==	"Nachrichten-HJ"
drop if dup>0 &		nsorganisation	==	"Musik-HJ"
drop if dup>0 &		nsorganisation	==	"Feldscher-HJ"
drop if dup>0 &		nsorganisation	==	"F.-HJ"

***Dropping when an individual joined a sub-group of the HJ***

list if duplicates>0

by PersID: egen firstjoined=min(entry_year)

drop if entry_year>firstjoined & duplicates>0 

***Dropping the two individuals listed as having joined the HY twice. Dropping the second time they joined***

list if duplicates>0

drop duplicates dup

sort PersID
by PersID: gen dup=cond(_N>1,_n,0)

by PersID: egen duplicates=max(dup)

list if duplicates>0


keep PersID entry_year entrymonth exitmonth exityear

save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Time in Hitler Youth.dta"


***Now generating a first muster date***

import excel "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Muster Date.xlsx", sheet("Sheet1") firstrow
drop Datum
save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\First Muster Date.dta"
drop if muster_month==.
destring muster_month muster_year, replace
save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\First Muster Date.dta", replace

gen mth=(muster_year-1900)+muster_month

sort PersID
by PersID: egen firstmuster=min(mth)

drop if mth!=firstmuster

duplicates report PersID

duplicates drop PersID, force

keep PersID muster_month muster_year

save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\First Muster Date.dta", replace


***Generating a 'month 18' variable****


import excel "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Month Turned 18.xlsx", sheet("Sheet1") firstrow
save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Month 18.dta"
duplicates report PersID


**No duplicates


use "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Time in Hitler Youth.dta", clear

gen startmonth=(entry_year-1900)*12+entrymonth
gen endmonth=(exityear-1900)*12+exitmonth

merge 1:1 PersID using "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Month 18.dta"

***Everyone matched to an eighteenth birthday***


drop if _merge==2
drop _merge

merge 1:1 PersID using "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\First Muster Date.dta"
drop if _merge==2
drop _merge

***245 individuals from the Hitler Youth not matched to a Muster Date***

destring year_eighteen month_eighteen muster_year muster_month, replace
gen eighteenthbirthday=(year_eighteen-1900)*12+month_eighteen
gen callup=(muster_year-1900)*12+muster_month

egen temp_month=rowmin(callup eighteenthbirthday)
replace endmonth=temp_month if endmonth==.


gen monthshy=endmonth-startmonth

la var monthshy "Months in the Hitler Youth"

***This creates 104 individuals who apparently spent 'negative time' in the Hitler Youth***

***These were almost all individuals who turned eighteen before joining the HY. Presumably they joined as instructors***

drop mm temp_month

***Replacing instead with the date they were called up or the last month of their exit year***


gen em=(exityear-1900)*12+12
gen em2=(muster_year-1900)*12+muster_month

replace em2=em if em2==.

gen hy_instructor=1 if monthshy<0
replace hy_instructor=0 if hy_instructor!=1

replace endmonth=em2 if monthshy<0

replace monthshy=endmonth-startmonth

***Some individuals joined the HY as instructors after serving in the Army and after turning eighteen. We have no way of knowing how long they were in the HY for***
***Eight individuals joined on their eighteenth birthday. These individuals are coded as 'unknown'***

replace monthshy=. if monthshy<0
replace monthshy=. if monthshy==0

la var monthshy "Months In the Hitler Youth"
la var hy_instructor "Individual was in the HY as an instructor" 

keep PersID monthshy hy_instructor




















							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
